﻿using InnoWeb.CEND.Core.Model.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace InnoWeb.CEND.Data.Mapping.BaseMapping
{
    public abstract class BaseMappingConfiguration<T, K> : EntityTypeConfiguration<T>
        where T : BaseEntity<K>
        where K : struct
    {
        protected BaseMappingConfiguration()
        {
            this.HasKey(a => a.Id);
            this.Property(a => a.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.Property(a => a.CreatedDate).IsRequired();
            this.Property(a => a.IsActive).IsRequired();
            this.Property(a => a.IsDeleted).IsRequired();
            this.Property(a => a.ModifiedDate).IsOptional();
        }
    }
}
